freenode/#lisp - IRC Chatlog
Search
18:32:10
jasom
with-output-to-string is definitely the idiomatic way to accumulate values into a string.
18:36:32
fiddlerwoaroof
jmercouris: (reduce (lambda (acc next) (format acc "~a" next)) seq :initial-value (make-array 10 :element-type 'character :fill-pointer 0))
18:37:27
fiddlerwoaroof
Reduce is just a loop with an accumulator, so if you control the initial value there's no reason not to mutate it :)
18:38:25
fiddlerwoaroof
If some FP purist complains, just explain that you're using dynamic linear types.
18:38:36
jasom
fiddlerwoaroof: but at that point why use reduce at all, and just put the mutation in the loop body?
19:08:03
wanko
hello, is it okay to ask beginner scheme questions here, or is there a different channel for that?
19:46:43
dbotton
I assume there is no way in lisp to "use" the sequence passed to subseq as part of an expression to calculate end?
19:47:57
jasom
dbotton: I think various utility libraries let you do python-style passing of negative values for subseq ranges. I can't speak to the quality of any of them though.
19:48:22
Xach
dbotton: (defun trim-last-char (s) (subseq s 0 (1- (length s))) is what i might do if i didn't a cluttered expression
20:00:29
jasom
fiddlerwoaroof: but the original question was phrased in a way that assumes the sequence was of at least length 1
20:06:30
Bike
oh, i thought maybe sbcl might do its magic shrink-vectors-even-if-they-don't-have-fill-pointers thing but i guess it's too messy
20:54:36
dbotton
From a GitHub discussion "Clog is totally fun. It made me re-start learning Lisp." Thought I would share for those that help me
21:00:09
alanz
I know, which is why I am speaking up. I love seeing it come together bit by bit, and appreciate the effort you put in to making clear, understandable code
21:13:48
alanz
dbotton, I got as far as using your tutorial 13 as a base. Now scratching my head wondering what the next thing to do is. The general idea is to help managing entries to https://www.facebook.com/saflowerunion/posts/4851293668246422
21:18:54
dbotton
Since an admin tool, maybe consider using tutorial 22 as your base and have a nice look desktop motif
21:20:30
alanz
thanks, will do so. I also see myself interacting with the local file system, and showinng pictures. So the desktop one is definitely a good basis
21:21:53
alanz
its going to be slow though, this is a back-burner project for me, which I am using to learn cl at the same time (from some experience with elisp)
21:26:08
dbotton
And that is why my plan is to do a CLOG Lisp tutorial, it is a cool way for people to learn because they see results right away
21:27:25
dbotton
Still hope someone with better language skills takes me up on project :) but if not I will do
21:35:52
alanz
you are doing fine, as far as I can see. Being active and enthusiastic is the most important thing, I reckon
1:11:50
charles`
can't they just be macros? that then (sometimes) expand into implementation specific magic
1:26:09
_death
the self-modifying code issue is interesting.. not just because it uses "bletcherous" jargon, but also because it mentions "displacing macros", which I will now try to find more about.. my guess is that they "patch" the form in place with their expansion
5:56:11
holycow
docs updated. okay not tedious at all. i just need a tip on how to think about solving the problem and what to google for
5:59:37
holycow
i have a text file with a list of music files, one per line. i want to load the list of music files and i guess basically sort by 'i like it' 'i don't like it'. the interface part isnt too much of an issue. so uiop:read-file-lines works fine, but i am wondering how to 'store' the list of files in lisp ... maybe an array? I keep on reading about tokens as well. basically i will create a loop that will
5:59:43
holycow
loop over the list, ask me a question, record the answer and move on to the next one.
6:01:21
moon-child
can make a structure with a slot for the name of the file and a slot for whether you like it
6:03:30
beach
I would make a list of standard objects, one object per file, and have a like/don't like slot in it. I would not necessarily sort it right away. But then, I would hide the list behind a protocol (interface) that does not mention the representation.
6:05:16
ldbeth
for LOOP macro, how should I write (loop for j <<if (oddp j) then from 0 to x else from x down to 0 >> do ...)?
6:07:42
beach
There is no simple way. You may use FOR ... THEN instead of TO/DOWNTO, but it is not necessarily going to be prettier than two loops.