freenode/#lisp - IRC Chatlog
Search
19:23:38
brandflake11
Hey all, I am having trouble with some lisp programming I am working on with Common Music. There is a function called (rhythm) that takes a symbol that represents a music rhythm (quarter-note 'q, eighth note 'e). I made a function that can parse a list and return these symbols, but rhythm doesn't like its output. I get an error "Can't parse QUOTE as a rhythm." Would anyone be willing to look at a pastebin and see where I'm going wro
19:31:35
Nilby
I would guess it would have to be like: (setq test-list '(0 e 1 s 2 q 3 e 4 q 5 s 6 t))
19:32:40
brandflake11
Nilby: The rhythm function needs the quote though. Without it, I get the error "The value e is not of type number"
19:33:17
brandflake11
The documentation for rhythm says it takes symbols, so maybe something like that?
19:34:54
brandflake11
Nilby: Oh, actually, my fault, that was the problem. I was doing something silly. Thank you Nilby!
19:45:54
brandflake11
Okay, another problem. If I do the rhythm function in a loop, like (rhythm (list-select)), I get "The value e is not of type number when binding sb-kernel::x".
19:51:47
Nilby
It's passing i to list-select which expects it to be number, and it's a symbol every alternate time. So you'd probably have to do something like (loop for (i s) in test-list ... ) so that i would only be the numbers.
19:55:02
brandflake11
Nilby: It lets you create systems that make music, instead of you having to write the notes themselves
19:58:01
Nilby
I tried it a long time ago, but I realized I'm not so good a algorithmic composing. I'm more a mindless improviser.
20:13:39
Nilby
There's quite a few people who do music with lisp/scheme, from many years back. But even a new system was created recently: OpusModus
20:14:17
brandflake11
Nilby: I've never heard of OpusModus. Do you know of any artist names that I can look up and listen to music?
20:18:29
brandflake11
That's cool, so you know someone who wrote the software? The only other lisp composer that I found so far was Andrew Sorensen, and the pieces on http://commonmusic.sourceforge.net/
20:20:25
brandflake11
Nilby: I never thought that kind of thing was super interesting, until I saw it done with lisp. That changed everything for me
20:20:49
brandflake11
Lisp just looked faster than other languages when it came to live-coding music
20:21:44
brandflake11
Totally, especially if there's also visuals. I think it would be cool to also integrate some kind of body controller that can affect the music
20:36:07
phantomics
A while back I was experimenting with using April to generate midi notes, vector languages are good for live coding thanks to the terse syntax
20:37:36
phantomics
Combine it with Slime and you can have a code file that serves as an interface, where you can C-x C-e code blocks to produce different effects
20:38:44
brandflake11
phantomics: That's what I'm doing with common music. At this point anyways, text editing with anything else but emacs is tough for me :)
20:39:58
phantomics
It's a compiler from the APL language to CL, lets you do array transformations with very little code
20:47:39
phantomics
The protocol itself is extremely simple, it takes like 30 lines of code using the lisp-binary library to create each frame
20:48:24
phantomics
Each frame is just a vector of 8-bit ints, each 3 of them setting the R G B level of each pixel
23:45:37
phoe
unrelated: I have a question about CLHS 5.2 and the code from https://plaster.tymoon.eu/view/2323#2323
23:48:00
phoe
CLHS 5.2 point 1 implies that BLOCK FOO, as an intervening exit point, should be abandoned - so RETURN-FROM FOO should not be executed
23:48:25
phoe
and yet it seems to be executed on my implementations, and :EXIT-FOO is printed/returned
23:52:29
phoe
simplified the example a bit; now it's a question of whether 24 or 42 should be returned and whether this code is conforming
23:52:48
antonv
phoe: I wanted to ask how do people workaround https://github.com/roswell/roswell/issues/463
23:53:39
antonv
Meanwhile, I found a workaround - build roswell from source during the "install" phase
23:55:39
antonv
On your question, without reading CLHS, it's strange to assume (return-from foo ...) would ignore (block foo ...)
23:59:24
specbot
Transfer of Control to an Exit Point: http://www.lispworks.com/reference/HyperSpec/Body/05_b.htm
0:02:01
antonv
Ah, I understood your question little better now. You mean (return-from test), whould abandon (block foo ...), so (return-from foo) should not work...
0:03:54
antonv
The fact that it works on some exisging impls may be justified by "The consequences are undefined if an attempt is made to transfer control to an exit point whose dynamic extent has ended."
2:43:50
semz
phoe I'm pretty sure this was an explicit illegal example in the cleanup issue that made it illegal
2:59:43
semz
It was, Ctrl+F "returns 2 under MEDIUM, is error under MINIMAL": http://www.lispworks.com/documentation/HyperSpec/Issues/iss152_w.htm
3:12:17
ex_nihilo
phoe: isn't foo an intervening exit point since it lies between (return-from test 42) and the exit point; i.e., foo is no longer a valid exit point after (return-from test 42)? This would seem to make the behavior undefined
4:25:58
moon-child
that depends on how you measure. Fewer primitives, maybe, but overall I think the two are a similar size
4:27:19
beach
Common Lisp is mostly standard library functions. Not a collection of special cases for syntax.
4:28:32
beach
purpleLizard: Anyway, that's a pretty strange question. What if it did bother someone?
4:31:39
ex_nihilo
purpleLizard: even using a smallish language like C, you end up using libraries to get things done, and that means learning a lot more than the base language, and dealing with a lot of api inconsistencies; you just learn what you need and get on with things
4:31:43
beach
purpleLizard: The smaller the language is, the more you have to write yourself or rely on third-party contributions that people may not agree upon.
4:33:36
purpleLizard
I care more about specs that say how the language works, not library functions, that's ok
4:34:11
beach
purpleLizard: Common Lisp has a very simple core compared to most languages. It is much easier to learn because of that.
4:38:35
beach
purpleLizard: It seems you are new here. If you are having problems learning Common Lisp, then just ask. We will show you how simple things are, given the semantics of Common Lisp.
4:40:25
purpleLizard
I was looking for a language to write a compiler in, and also fit my peculiarites. No problems yet
4:43:07
purpleLizard
interesting, didn't think the object system would come up here, maybe for games :P
4:45:47
beach
Also, except for very few other languages (like PL/I for instance), Common Lisp has the only sane condition system around. Exceptions in other languages just don't cut it, as phoe's book clearly explains.